
var obj = {}; // 创建一个空对象
var person = {
    name: "Alice",
    age: 25,
    greet: function () {
        console.log("Hello, my name is " + this.name);
    }
};
function Person(name, age) {
    this.name = name;
    this.age = age;
}

var person = new Person("Bob", 30);
var personProto = {
    greet: function () {
        console.log("Hello, my name is " + this.name);
    }
};
var person = Object.create(personProto);
person.name = "Charlie";
person.age = 28;

class Student {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }

    greet() {
        console.log("Hello, my name is " + this.name);
    }
}

const student = new Student("Dave", 22);